package com.dfbz.demo01;

import java.util.Random;
import java.util.Scanner;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo04_Random小练习_03_猜拳 {
    public static void main(String[] args) {


        Scanner scanner = new Scanner(System.in);

        Random random = new Random();

        while (true){

            System.out.println("请输入您猜的数: ");
            int player = scanner.nextInt();
            int system = random.nextInt(10);

            if (player > system) {

                System.out.println("您输入的为【" + player + "】，系统的为【" + system+"】，大了！");
            }else if(player<system){
                System.out.println("您输入的为【" + player + "】，系统的为【" + system+"】，小了！");
            }else{
                System.out.println("您输入的为【" + player + "】，系统的为【" + system+"】，恭喜！");
                break;
            }

        }

        System.out.println("程序结束！");

    }
}
